#include <iostream>
#include <string>

using namespace std;

void PrintCombinations(char* str){
	int N=strlen(str);

	//	from 2^0~2^N-1
	for(int M=1;M<1<<N;M++) {
		printf("%d:   ",M);
		int Mask=1;
		for(int i=0;i<N;i++) {
			//if this bit is 1,print it!
			if(M&Mask){
				printf("%c",str[i]);
			}
			Mask <<= 1;
		}
		printf("\n");
	}
}
int main(int argc, char* argv[]) {
	char* str="hart";
	PrintCombinations(str);
	return 0;
}

